package com.garen.sys.web;

import com.garen.sys.biz.IFireRoleBiz;
import com.garen.sys.entity.FireRole;
import org.springframework.stereotype.Controller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import com.garen.common.*;
import org.springframework.web.servlet.ModelAndView;
import com.garen.sys.filter.SysFilter;


@Controller
@RequestMapping("/sys")
public final class FireRoleAction extends BaseAction{

	protected static Log log = LogFactory.getLog(FireRoleAction.class);

	@Autowired
	private IFireRoleBiz iFireRoleBiz;

	@RequestMapping("/firerole/json") 
	public ModelAndView json(PageBean<FireRole> pb,FireRole fireRole) {
		iFireRoleBiz.getFireRoleList(pb,fireRole);
		return Json(pb);
	}

	@RequestMapping("/firerole/boxJson") 
	public ModelAndView boxJson(FireRole fireRole) {
		return Json(iFireRoleBiz.getFireRoleList(fireRole));
	}

	@RequestMapping("/firerole/edit") 
	public ModelAndView edit(ModelAndView mav,FireRole fireRole) {
		mav.setViewName("sys/FireRoleEdit");
		if(fireRole.getRoleId() != null){
			fireRole=iFireRoleBiz.getFireRole(fireRole);
		}
		mav.addObject("fireRole",fireRole);
		return mav;
	}

	@RequestMapping("/firerole/save") 
	public ModelAndView save(FireRole fireRole) {
		MsgBean mbean = SysFilter.getMsgBean(0, "保存成功 !");
		iFireRoleBiz.saveFireRole(mbean,fireRole);
		return Json(mbean);
	}

	@RequestMapping("/firerole/del") 
	public ModelAndView del(FireRole fireRole) {
		MsgBean mbean = SysFilter.getMsgBean(0, "删除成功 !");
		iFireRoleBiz.delFireRole(mbean,fireRole);
		return Json(mbean);
	}

}
